from solution import Solution


def test():
    sol = Solution()
    test_cases = [
        ([1, 1, 2], 2),
        ([0, 0, 1, 1, 1, 2, 2, 3, 3, 4], 5),
        ([], 0),
        ([1, 2, 3], 3),
        ([1, 1, 1], 1),
    ]

    for i, (nums, expected) in enumerate(test_cases):
        k = sol.removeDuplicates(nums)
        assert k == expected, f"Case {i} failed: expected {expected}, got {k}"
        # Verify the first k elements are unique and in order
        for j in range(1, k):
            assert (
                nums[j] > nums[j - 1]
            ), f"Case {i} failed: duplicates found in first {k} elements"
        print(f"Case {i} passed")
    print("All tests passed!")


if __name__ == "__main__":
    test()
